/**
 * @author：anlzou
 * @Date：Created in16:58 2021/4/12
 * @Github：https://github.com/anlzou
 * @Description：
 */
package com.anlzou.dao;

import java.io.Serializable;

/**
 * 序列化的类必须实现Serializable接口
 */
public class Person implements Serializable {
    private String name;
    private int age;
    //不会序列化，默认为null
    private transient String sex;

    public Person(String name, int age){
        this.name = name;
        this.age = age;
    }

    public Person(String name, int age, String sex){
        this.name = name;
        this.age = age;
        this.sex = sex;
    }

    public void printStr() {
        System.out.println("Person{" +
                "name='" + this.name + '\'' +
                ", age=" + this.age + '\'' +
                ", sex=" + this.sex +
                '}');
    }
}
